package com.source.auto.utils;

/**
 * @author wangchangjie
 * @date 2025/1/16 09:55
 */
public class LogUtil {

    public static String[] loading = {"-", "\\", "|", "/"};


    public static void printfMaster(String msg){
        System.out.printf("\033[0m"+msg+ "%n");
    }

    public static void printfMaster(String msg, Object... args){
        System.out.printf("\033[0m"+(msg.replaceAll("\\{}", "%s")) + "%n", args);
    }



    public static void printf(String msg){
        System.out.printf("\033[0m"+msg+ "%n");
    }

    public static void printf(String msg, Object... args){
        System.out.printf("\033[0m"+(msg.replaceAll("\\{}", "%s")) + "%n", args);
    }



    public static void info(String msg){
        System.out.printf("\033[32mINFO "+DateUtil.getDateNow()+" "+msg+ "%n");
    }

    public static void info(String msg, Object... args){
        System.out.printf("\033[32mINFO "+DateUtil.getDateNow()+" "+(msg.replaceAll("\\{}", "%s")) + "%n", args);
    }


    public static void infoPrint(String msg){
        System.out.printf("\033[32mINFO "+DateUtil.getDateNow()+" "+msg);
    }
    public static void infoPrint(String msg, Object... args){
        System.out.printf("\033[32mINFO "+DateUtil.getDateNow()+" "+String.format(msg.replaceAll("\\{}", "%s"), args));
    }


    public static void error(String msg){
        System.err.printf(msg+ "%n");
    }
    public static void error(String msg, Object... args){
        System.err.printf((msg.replaceAll("\\{}", "%s")) + "%n", args);
    }

}
